package cn.aishu.common;

import org.apache.commons.lang3.StringUtils;
import org.springframework.util.DigestUtils;

import java.nio.charset.StandardCharsets;

/**
 * 工具箱
 */
public class ToolBox {

    public static final String salt = "zdsaw1";

    /**
     * 生成md5
     */
    public static String md5(String str) {
        if (StringUtils.isEmpty(str)) {
            throw new AishuException(false, "参数不合法！", null);
        }
        return DigestUtils.md5DigestAsHex((str + salt).getBytes(StandardCharsets.UTF_8));
    }
}
